home *** CD-ROM | disk | FTP | other *** search
- /*
- ** kbdready.c
- **
- ** Pictor, Version 1.51, Copyright (c) 1992-94 SoftCircuits
- ** Redistributed by permission.
- */
-
- #include "pictor.h"
-
- extern int _PL_pushedkey;
-
- /*
- ** Returns the next available keystroke without removing it from
- ** the keyboard buffer. Returns 0 if no keystrokes available.
- */
- int kbdready(void)
- {
- int key = 0;
-
- if(_PL_pushedkey) {
- key = _PL_pushedkey;
- }
- else {
- /* use in-line assembler to correctly */
- /* detect an empty keyboard buffer */
- _asm mov ah,01h
- _asm int 16h
- _asm jz end_kbdready
- _asm cmp ax,1
- _asm adc ax,0
- _asm mov key,ax
- }
- end_kbdready:
-
- return(key);
-
- } /* kbdready */
-